/**
 * 
 */
package com.wbl.server;

import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.handler.timeout.IdleStateHandler;

/**
 * @Description:  
 * 这里有一个心跳控制，和一个多规约handler控制
 * @version: v1.0.0
 * @author: wbl
 * @date: 2019年8月30日 下午2:48:22
 */
public class DivChannelInitializer extends ChannelInitializer<SocketChannel>{
	//自定义心跳时间，用于本地效果测试
		public static String PROTOCOL_TYPES = "1";
		public static int HEARTBEATTIME = 300;
		public static TimeUnit TIME_UNIT = TimeUnit.SECONDS;
		public static int client_active = 0;
	/**
	 * @Description: 
	 *
	 */
	@Override
	protected void initChannel(SocketChannel channel) throws Exception {
		    channel.pipeline().addLast(new IdleStateHandler(HEARTBEATTIME, 
		    		0, 0, TIME_UNIT));
	 
	        channel.pipeline().addLast(new StringDecoder());
	        channel.pipeline().addLast(new StringEncoder());
	        channel.pipeline().addLast(new DivServerHandler());
	        

	 
	       
	}

}
